﻿using System.ComponentModel.Composition;
using System.Linq;
using System.Web.Mvc;
using Mefisto.Core.Mvc.Controllers;
using Mefisto.Core.Packages;

namespace Mefisto.Web.Areas.Admin.Controllers
{
    [Export(typeof(MefistoController))]
    public class PackageController : MefistoController
    {
        #region Imported Fields

        public PackageManager PackageManager { get; set; }

        #endregion

        #region Constructor

        public PackageController()
        {
            PackageManager = Import<PackageManager>();
        }

        #endregion

        public ActionResult Index()
        {
            var availablePackageCount = PackageManager.GetPackages().Count();
            var firstAvailablePackage = PackageManager.GetPackages().Take(10).ToList();
            return View(firstAvailablePackage);
        }
    }
}
